package com.czkevin.cif;

import de.tr7zw.nbtapi.NBTCompound;
import de.tr7zw.nbtapi.NBTContainer;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;

import java.util.List;

public interface CIFItem {

    String type();

    String getDisplayName(NBTCompound data);

    default Material getModelMaterial() {
        return Material.DIAMOND_HOE;
    }

    default int getDefaultModelData() {
        return getCustomModelData(null);
    }
    default int getCustomModelData(CIFItemInstance instance) { return 0; }

    default boolean onPlace(CIFItemInstance instance, PlayerInteractEvent event) { return true; }
    default boolean onBreak(CIFItemInstance instance, Block block, Entity entity) { return true; }
    default void onBroken(CIFItemInstance instance, Block block, Entity by) { }
    default void onBlockUse(CIFItemInstance instance, PlayerInteractEvent event) { }

    default void onUseInHand(CIFItemInstance instance, PlayerInteractEvent event) { return; }

    boolean isBlock();

    default boolean shouldKeepModelDataWhenAcquired() { return false; }

    NBTContainer generateItemNBT(CIFItemInstance instance, boolean isBlock);
    ItemStack generateItemStack(CIFItemInstance instance, boolean isBlock);

    boolean isSimilar(CIFItemInstance itemA, CIFItemInstance itemB);

    default boolean isUnbreakable() { return true; }

    default List<String> getLore(CIFItemInstance instance) { return null; }

    @Override
    String toString();
}
